<extend name="Base/common"/>
<block name="body">
    <div class="try_count insurance">
        <div class="width1000">
            <div class="step_info">
                <div class="write_info">录入保单信息</div>
                <div class="get_price">获取精确报价</div>
                <div class="cash_money">支付保单</div>
                <div style="clear:both"></div>
            </div>
            <div class="ins_tab">
                <a href="{:U('Insurance/index')}" class="f_l ">定制我的车险</a>
                <a href="javascript:void(0);" class="f_l ins_tab_li">试算我的保费</a>
            </div>
            <form action="{:U('select')}" method="post" class="form_all" id="forms">
                <div class="clear form_list">
                    <div class="span3 f_l t_r">
                        <span class="form_list_left">车辆品牌</span>
                    </div>
                    <div class="span7 f_l">
                        <select name="brand" id="brand">
                        <volist name="brands" id="item">
                            <option value="{$item.brand_id}">{$item.brand_alpha}-{$item.brand_name}</option>
                        </volist>
                        </select>
                        <span class="help_msg"></span>
                    </div>
                </div>
                <div class="clear form_list">
                    <div class="span3 f_l t_r">
                        <span class="form_list_left">车系</span>
                    </div>
                    <div class="span7 f_l">
                        <select name="series" id="series">
                            <option value="">宝马5系</option>
                        </select>
                       
                        <span class="help_msg"></span>
                    </div>
                </div>
                <div class="clear form_list">
                    <div class="span3 f_l t_r">
                        <span class="form_list_left">车型</span>
                    </div>
                    <div class="span7 f_l">
                       <select name="model" id="model">
                           <option value="">525Li</option>
                       </select>
                        <span class="help_msg"></span>
                    </div>
                </div>
                
                <input type="submit" value="计算保费" class="form_submit" />
            </form>
        </div>
        
    </div>
</block>
<block name="script">
<script type="text/javascript">
    $('#brand').change(function(){
        var bId = $(this).val();
        $.post("{:U('getSeries')}","id="+bId,function(data){
            if(data.status){
                var series = $('#series'),models = $('#model');
                series.html('');
                models.html('');
                for(var i=0;i<data.info.length;i++){
                    var o = data.info[i];
                    $('<option value="' + o.series_id + '">' + o.series_name + '</option>').appendTo(series);
                }
                $('#series').trigger('change');
            }else{
                alert(data.info);
            }
        },'json');
    });
    $('#series').change(function(){
        var sId = $(this).val();
        $.post("{:U('getModel')}","id="+sId,function(data){
            if(data.status){
                var models = $('#model');
                models.html('');
                for(var i=0;i<data.info.length;i++){
                    var o = data.info[i];
                    $('<option value="' + o.model_id + '">' + o.model_name + '</option>').appendTo(models);
                }
            }else{
                alert(data.info);
            }
        },'json');
    });
    
    $('#brand').trigger('change');
</script>
</block>
